package com.onesports.intelligent.k12.polarlight.controller.organization.evaluation;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.onesports.intelligent.k12.polarlight.common.utils.ResultUtil;
import com.onesports.intelligent.k12.polarlight.constant.ApiPathConstants;
import com.onesports.intelligent.k12.polarlight.domain.dto.market.EducationEvaluationRecordPageDTO;
import com.onesports.intelligent.k12.polarlight.domain.vo.market.EducationEvaluationRecordPageVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.market.EducationEvaluationRecordVO;
import com.onesports.intelligent.k12.polarlight.service.evaluation.EducationEvaluationRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author FPH
 * @since 2022年7月18日15:43:38
 */
@Api(tags = "机构端-教学管理-教学评价")
@RequestMapping(ApiPathConstants.ORG_EVALUATION)
@RequiredArgsConstructor
@RestController
@PreAuthorize("isAuthenticated()")
public class EducationEvaluationRecordController {
    private final EducationEvaluationRecordService educationEvaluationRecordService;

    @PostMapping("page")
    @ApiOperation("分页")
    public ResponseEntity<IPage<EducationEvaluationRecordPageVO>> getPage(@RequestBody @Valid EducationEvaluationRecordPageDTO dto){
        return ResultUtil.success(educationEvaluationRecordService.getPage(dto));
    }

    @GetMapping("detail")
    @ApiOperation("详情")
    public ResponseEntity<EducationEvaluationRecordVO> getPage(String id){
        return ResultUtil.success(educationEvaluationRecordService.getDetail(id));
    }
}
